// import Cookies from 'js-cookie'

const TokenKey = 'mfToken'
const Avatar = 'mfAvatar'
const NickName = 'mfName'

// 存储token
export function getToken() {
  return localStorage.getItem(TokenKey) ? `Bearer ${localStorage.getItem(TokenKey)}` : "";
}

export function setToken(token) {
  return localStorage.setItem(TokenKey, token, { expires: 1 })
}

export function removeToken() {
  return localStorage.setItem(TokenKey, '')
}

// 存储头像
export function setAvatar(avatar) {
  return localStorage.setItem(Avatar, avatar, { expires: 1 })
}

export function getAvatar() {
  return localStorage.getItem(Avatar)
}

export function removeAvatar() {
  return localStorage.setItem(Avatar, '')
}

// 存储用户名
export function setnickName(name) {
  return localStorage.setItem(NickName, name, { expires: 1 })
}

export function getnickName() {
  return localStorage.getItem(NickName)
}

export function removeName() {
  return localStorage.setItem(NickName, '')
}